Windows Podman & Oracle Container Registry & VS Code – What a Match!

Introduction

Podman utilizes a daemonless architecture to run Linux containers on Windows through the Windows Subsystem for Linux 2 (WSL2), providing full Linux kernel compatibility and high performance. Podman Desktop offers a graphical interface for managing containers and images, enhancing usability by integrating seamlessly with WSL2’s capabilities. This combination delivers a powerful container management solution for Windows users, leveraging the strength of Linux containers directly within a Windows environment.

Together with the Oracle provided images on the container registry and the very popular Visual Studio Code, you get a powerful platform for Oracle SQL & PL/SQL Development.

 

Installation

  1. Install and Setup Podman Desktop for Windows & Podman
  2. Download and run Oracle 23c Free Image
  3. Setup Visual Studio Code

Install and Setup Podman Desktop for Windows & Podman

For Windows, several install methods like Silent Windows installer, Chocolatey, Scoop and Winget are available. Link to the installation methods: Windows | Podman Desktop (podman-desktop.io). Download Podman Desktop for Windows for your platform HERE and run the installer. If Windows Subsystem for Linux – WSL2 – is not already installed on your notebook, the setup process installs it for you. After the WSL2 installation, a workstation restart is required. My favorite is to install WSL without any distribution (wsl –install –no-distribution as Administrator).

C:\>wsl --install --no-distribution
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.
The requested operation is successful. Changes will not be effective until the system is rebooted.

C:\>wsl --version
WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.3296

Requirements according How to install and use Podman Desktop on Windows | Red Hat Developer:

  • Windows 10 or 11
  • 6GB of RAM
  • Windows Subsystem for Linux WSL

What is the difference between Podman and Podman Desktop? Podman is a daemonless, open source, Linux native tool designed to make it easy to run and deploy containerized applications, where as Podman Desktop is a visual application “on top” of Podman to manage Podman and Kubernetes environments.

Setup Podman

After the download, run podman-desktop installer, in my case it’s podman-desktop-1.8.0-setup-x64.exe. Podman is not able to find any Podman extension as the installation is not done yet. Run Set up first to install the integration.

# Screen 1: Press Install to for the Podman software installation process. Memory and WSL are verified.

# Screen 2: Press Next button to setup Podman software.

# Screen 3: If all requirements are fulfilled like Memory and WSL2, the installer asks for install Podman Software. Click Yes.

# Screen 4: Click Install button.

# Screen 5: Confirmation, Podman is successfully installed. Click Close.

# Screen 6: Enable Autostart, click Next.

# Screen 7: A Podman machine image is created, click Next.

# Screen 8: Let the sizing as recommended, scroll down the settings and click Create. Be patient, a new machine is created in the background wtith a size of about 1.6GB.

# Screen 9: Confirmation the machine is created, click Next. The message of the uncomplete setup can be closed by pressing X on Podman dashboard..

On Windows command line, verify setup with wsl.exe command. A new distribution called podman-machine-default (Default) is created. This dstribution is required to interact between Podman and WSL.

C:\>wsl --list
Windows Subsystem for Linux Distributions:
podman-machine-default (Default)

Test Podman Setup

In Windows CLI, run a small test container. You can find the image and the container in Podman Desktop afterwards.

C:\>podman run quay.io/podman/hello
Trying to pull quay.io/podman/hello:latest...
Getting image source signatures
Copying blob sha256:83d537244900c28f59d4d13c5266acc0785df6ce953cfce51a4fb266182d198b
Copying config sha256:a4e07799a34b7d825040a48c4b22d99298cf306b4b93b2d34f4e98bceb5590e1
Writing manifest to image destination
!... Hello Podman World ...!

         .--"--.
       / -     - \
      / (O)   (O) \
   ~~~| -=(,Y,)=- |
    .---. /`  \   |~~
 ~/  o  o \~~~~.----. ~~
  | =(X)= |~  / (O (O) \
   ~~~~~~~  ~| =(Y_)=-  |
  ~~~~    ~~~|   U      |~~

Project:   https://github.com/containers/podman
Website:   https://podman.io
Desktop:   https://podman-desktop.io
Documents: https://docs.podman.io
YouTube:   https://youtube.com/@Podman
X/Twitter: @Podman_io
Mastodon:  @Podman_io@fosstodon.org

Download and run Oracle 23c Free Image

In Windows CLI, execute the Podman command podman run to pull and run the Oracle 23c Free image container. The image is pulled first to the local repository before started. If you want to run the container in the background, use the -d parameter in run command. Clicke HERE to get more information about the container image.

C:\>podman run -d --name free23c -p 1521:1521 -e ORACLE_PWD=oracle123 container-registry.oracle.com/database/free:latest

  • -d: the container runs in the background
  • –name: we call it free 23c, makes it more user friendly to connect by shell etc.
  • -p: port mapping, feel free to set another port if already used or not ok for you
  • -e: we set the SYS password

If you are not sure if it works, start without the -d parameter first to see what happens on screen immediately.

Verify Logs and connect by CLI

Verify if the container is running by podman ps:

C:\>podman ps
CONTAINER ID  IMAGE                                               COMMAND               CREATED         STATUS
         PORTS                   NAMES
65c2c6703eaf  container-registry.oracle.com/database/free:latest  /bin/bash -c $ORA...  28 minutes ago  Up 28 minutes (healthy)  0.0.0.0:1521->1521/tcp  free23c

Show Alertlog content by podman logs:

C:\>podman logs free23c
2024-03-18T17:38:14.880066+00:00
PDB$SEED(2):Opening pdb with Resource Manager plan: DEFAULT_PLAN
FREEPDB1(3):Autotune of undo retention is turned on.
2024-03-18T17:38:15.496150+00:00
FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN
Completed: Pluggable database FREEPDB1 opened read write
Completed: ALTER DATABASE OPEN
2024-03-18T17:38:15.885002+00:00
FREEPDB1(3):TABLE AUDSYS.AUD$UNIFIED: ADDED INTERVAL PARTITION SYS_P342 (3549) VALUES LESS THAN (TIMESTAMP' 2024-03-19 00:00:00')

Login in container and run SQL*Plus by podman exec:

C:\>podman exec -it free23c sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Tue Mar 12 10:27:05 2024
Version 23.3.0.23.09

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 FREEPDB1                       READ WRITE NO

In Podman Desktop, you can see Oracle container in state Running.

Setup Visual Studio Code

Install the VS Code SQL Developer plugin – https://www.oracle.com/database/sqldeveloper/vscode/ – and configure a new connection. Fill in the configuration data corresponding the run command from above. Test the connection and save it

# Screen 1: Create Connection

# Screen 2: Open a new file and execute a SQL command by press Ctrl+Enter at the end of the line. You see the query result below.

Troubleshooting

Error during Podman machine start:

C:\>podman machine start
Starting machine "podman-machine-default"
Failed to attach disk 'C:\Users\<username>.local\share\containers\podman\machine\wsl\wsldist\podman-machine-default\ext4.vhdx' to WSL2: The system cannot find the path specified.
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_PATH_NOT_FOUND
Failed to attach disk 'C:\Users\<username>.local\share\containers\podman\machine\wsl\wsldist\podman-machine-default\ext4.vhdx' to WSL2: The system cannot find the path specified.
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_PATH_NOT_FOUND
Error: the WSL bootstrap script failed: exit status 0xffffffff

Solution:

-- remove old image
C:\> podman machine rm podman-machine-default
-- initialize new machine
C:> podman machine init
-- start new machine
C:> podman machine start